
Technotes
Technote 1068
|
September 1996
|
By Dave Polaschek
dpolasch@apple.com
Apple Developer Technical Support (DTS)
LaserWriter 8.4 offers a new graphical way to customize the interface presented
to the user for selecting printer-specific options that are defined in
PostScript Printer Description (PPD) files. This Technote describes how to
access those features.
This Technote assumes you are already familiar with the PPD specification. If
you are not familiar with how to make PPD files, you should first consult the
PostScript Printer Description File Format Specification Version 4.3, which is
available from Adobe Systems, Inc. (An earlier version of the spec (1865K) is available online at Adobe's Website.)
Resource IDs
Resource IDs must be in the range of driver-owned resources, i.e., -8160 to
-4090, but the resources used in your PPD file should be in the ID range of
-7500 to -7000 to avoid conflicts with future revisions of the LaserWriter
driver.
Icons
The four icon families in the PPD files are optional, but when they are there, the LaserWriter driver and Desktop Printing software will use them to represent a printer setup with that
PPD file. Icon family -16455 is the Finder custom icon. Three additional icon families are pointed to by the BNDL resource of the PPD file. The types for these icons are 'dpnn' for the default
icon (probably the same as the custom finder icon you provide), 'dpcn' for the
selected version of the icon (with a bold border around it), and 'dpna' for the
not available version of the icon (the crossed-out version of the icon). Even though Apple uses the IDs -7189, -7188, and -7187 for these icon families, and resource ID
-7192 for the 'BNDL' resource, none of these ID numbers are reserved, and developers are encouraged to use them.
Customizing the Panels Within the Print Dialog
The items displayed within the Printer Specific panel of the print dialog are
controlled by resources within the PPD file. There are two main resources you
need to define: the 'ppdT' and an associated 'DITL' resource. A template for
the 'ppdT' resource is contained within the LaserWriter 8.4 driver. The 'ppdT'
resource you create needs to have the signature set to 'rbi1' and the version
set to 1. The 'DITL' resource must have the same ID as the 'ppdT' resource.
Also note that the coordinates within the 'DITL' resource are local to the
print dialog, and you have the ability to construct a 'DITL' which would draw
items over areas used by the driver. Don't do that. It will be a future
compatibility problem.
Adding Items to the 'ppdT' Resource
Once you've created the base resource, you can add items to it. Items are added
as follows:
- Checkboxes are defined by an item number, and the keyword which specifies
which option they control. The Item number corresponds to the item number
within the DITL. The keyword matches the name of an option as defined with the
*OpenUI keyword in the PPD file.
- Radio Buttons are defined by a range of item numbers, which must be
contiguous and a keyword.
- Menus are defined by an item number and a keyword. The item number must
point to a control item within the 'DITL', which corresponds to a 'CNTL'
resource which references the built-in Popup Menu CDEF.
- PICT controls are the most complicated to define. The item number
corresponds to a user item within the DITL that has the correct placement and
size. The color-offID is the ID of a PICT resource to be displayed when the
option is not chosen, and the monitor depth is 8-bit color or greater. The
1bit-offID is used when monitor depth is less than 8-bit color. The onID
entries are similar, except for when the option is chosen. The forbiddenID
entries are used when the option cannot be chosen due to a UIConstraint within
the PPD file (usually the same as the off choice, except with an added red X
through the picture). The main entry again corresponds to the keyword within
the PPD, and the option entry corresponds to the option which is the "ON" state
for that keyword.
Adding Balloon Help
You can add balloon help to the items described in your DITL in the same way
you would for dialog items in an application. You add a help item to the DITL,
it points to a 'hdlg' and that gets appended to any already existing balloon
help. The only thing to remember is that the PICT controls used by LaserWriter
8 don't actually have multiple states, so you need to write the help string for
those items so it covers all the possible cases. For more information on
Balloon Help and the 'hdlg' resource, see Inside Macintosh: More Macintosh
Toolbox, Chapter 3. Make sure that your help resources are also in the
range specified above.
Summary
That's all there's to it. The best examples available are the PPDs supplied
with LaserWriter 8.4 for use with Apple printers.
Further Reference
- Adobe PostScript Printer Description Specification, pg. 1
- PostScript Language Reference Manual, 2nd Edition
Acknowledgments
Thanks to Steve Simon and Rich Blanchard.
Tech Support
Technotes
Previous Technote | Contents | Next Technote

Main |
Page One |
What's New |
Apple Computer, Inc. |
Find It |
Contact Us |
Help